<?php
namespace Wap\Controller;
use Think\Controller;
use Wap\Model;
use Wap\Service\SessionService;
use Wap\Service\UploadService;

class TeacherController extends Controller
{
	/**
	 *
	 */
	public function index()
	{
		$this->display( "teacher" );
	}

	public function fetch_rank()
	{
		$page	=	I( "get.page", 1, "" );
		$limit	=	I( "get.limit", 10, "" );

		$model	=	D( "teacher" );
		$result	=	$model->fetch_rank( $page, $limit );

		$this->ajaxReturn( $result );
	}


	public function fetch_students()
	{
// 		$uid	=	I( "get.uid", "", "" );
		$uid	=	SessionService::id_user();
		$status	=	I( "get.status", 1, "" ); //默认读取审核通过的作品
		$page	=	I( "get.page", 1, "" ); //1:默认从第一页开始读取
		$limit	=	I( "get.limit", 10, "" ); //默认每页读取10个

		$result = 	array( "error" => 0, "msg" => "");
		if( empty( $uid ) || $uid == null ){
			$result['error'] = 1;
			$result['msg']	=	"404";
			$this->ajaxReturn( $result );
		}

		$model	=	D( "teacher" );
		$result	=	$model->fetch_students( $uid, $status, $page, $limit );

		$this->ajaxReturn( $result );
	}
}
?>
